package GUI.Dog;

/**
 * this window display search results for dogs
 */

import java.awt.Color;
import java.awt.Font;
import java.awt.SystemColor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.border.BevelBorder;
import javax.swing.border.LineBorder;
import javax.swing.table.DefaultTableModel;

import Entity.Dog;
import GUI.Course.CourseManage;
import GUI.Report.ReportManage;
import GUI.Test.TestManage;
import java.awt.ScrollPane;

public class ShowSerachDogs extends JFrame {

	private static final long serialVersionUID = 1L;
	private JTable table;
	private ArrayList<Dog> dogs;
	private JTable table_1;
 	@SuppressWarnings("unused")
	public ShowSerachDogs(ArrayList<Dog> dogList1) {
 		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 	dogs=dogList1;
	setTitle("\u05EA\u05D5\u05E6\u05D0\u05D5\u05EA \u05D4\u05D7\u05D9\u05E4\u05D5\u05E9");
	this.setSize(600, 500);
	
	JButton button_2 = new JButton("\u05E7\u05D5\u05E8\u05E1\u05D9\u05DD");
	button_2.setFont(new Font("David", Font.PLAIN, 14));
	button_2.setBackground(UIManager.getColor("Button.background"));
	button_2.setBounds(431, 178, 111, 23);
	button_2.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent arg0) {
			setVisible(false);
			CourseManage coursewindow=new CourseManage();
			coursewindow.setVisible(true);
			
			
			
		}
	});
	getContentPane().setLayout(null);
	getContentPane().add(button_2);
	
	JButton button_1 = new JButton("\u05DE\u05D1\u05D7\u05E0\u05D9\u05DD");
	button_1.setBounds(431, 292, 111, 23);
	button_1.setFont(new Font("David", Font.PLAIN, 14));
	button_1.setBackground(UIManager.getColor("Button.background"));
	button_1.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			setVisible(false);
			TestManage testwindow=new TestManage();
			testwindow.setVisible(true);
			
		}
	});
	getContentPane().add(button_1);
	
	JButton button = new JButton("\u05D3\u05D5\u05D7\u05D5\u05EA");
	button.setFont(new Font("David", Font.PLAIN, 14));
	button.setBackground(UIManager.getColor("Button.background"));
	button.setBounds(431, 236, 111, 23);
	button.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			setVisible(false);
			ReportManage reportwindow=new ReportManage();
			reportwindow.setVisible(true);
		}
	});
	getContentPane().add(button);
	
	JButton btnNewButton = new JButton("\u05DE\u05D0\u05D2\u05E8 \u05DB\u05DC\u05D1\u05D9\u05DD");
	btnNewButton.setFont(new Font("David", Font.BOLD, 16));
	btnNewButton.setBounds(431, 126, 111, 23);
	btnNewButton.setBackground(UIManager.getColor("Button.background"));
	getContentPane().add(btnNewButton);
	btnNewButton.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			setVisible(false);
			DogManage dogwindow=new DogManage();
			dogwindow.setVisible(true);
			
		}
	});

	
	getContentPane().setLayout(null);
	
	JPanel panel = new JPanel();
	panel.setBounds(10, 95, 411, 312);
	panel.setBorder(new LineBorder(new Color(0, 0, 0), 2));
	getContentPane().add(panel);
	panel.setLayout(null);
	
	JLabel label_1 = new JLabel("\u05EA\u05D5\u05E6\u05D0\u05D5\u05EA \u05D4\u05D7\u05D9\u05E4\u05D5\u05E9:");
	label_1.setHorizontalAlignment(SwingConstants.RIGHT);
	label_1.setFont(new Font("David", Font.PLAIN, 16));
	label_1.setBounds(45, 11, 198, 23);
	panel.add(label_1);
					
					table_1 = new JTable();
					table_1.setModel(new DefaultTableModel(
						new Object[][] {
							{"\u05DE\u05E1\u05E4\u05E8 \u05D4\u05DE\u05DC\u05D8\u05D4", "\u05D0\u05D1\u05D0", "\u05D0\u05DE\u05D0", "\u05DE\u05D9\u05DF", "\u05E9\u05DD"},
						},
						new String[] {
							"New column", "New column", "New column", "New column", "New column"
						}
					));
					table_1.setFont(new Font("David", Font.BOLD, 14));
					table_1.setBorder(new BevelBorder(BevelBorder.LOWERED, new Color(0, 0, 0), null, null, null));
					table_1.setBackground(SystemColor.menu);
					table_1.setBounds(10, 55, 391, 16);
					panel.add(table_1);
					
					ScrollPane scrollPane = new ScrollPane();
					scrollPane.setBounds(10, 69, 391, 233);
					panel.add(scrollPane);
					
			
				
					
					
					table = new JTable(dogs.size(),5);
				//	panel.add(table);
					table.setSize(scrollPane.getSize());
					table.setFont(new Font("David", Font.PLAIN, 14));
					scrollPane.add(table);
					
					table.setBackground(SystemColor.menu);
					table.setBorder(null);
				
					JButton button_3 = new JButton("\u05D9\u05E6\u05D9\u05D0\u05D4 \u05DE\u05D4\u05DE\u05E2\u05E8\u05DB\u05EA");
					button_3.setFont(new Font("David", Font.PLAIN, 14));
					button_3.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent e) {
							System.exit(0);
						}
					});
					button_3.setBounds(10, 418, 130, 23);
					getContentPane().add(button_3);

	
	
	for(int i=0;i<dogs.size();i++)
	{
		
			table.setValueAt(dogs.get(i).getBirthnum(),i,0);
			table.setValueAt(dogs.get(i).getFather(),i,1);
			table.setValueAt(dogs.get(i).getMother(),i,2);
			table.setValueAt(dogs.get(i).getGender(),i,3);
			table.setValueAt(dogs.get(i).getName(),i,4);


	}
	ImageIcon ic=new ImageIcon("C:/Project/IDF1/MiscFiles/okets.jpg");
	JLabel lblNewLabel_1 = new JLabel(new ImageIcon("C:/Project/IDF1/MiscFiles/Picture4.jpg"));
	lblNewLabel_1.setBounds(-13, -84, 612, 610);
	getContentPane().add(lblNewLabel_1);
	
	ImageIcon ic1=new ImageIcon("C:/Project/IDF1/MiscFiles/okets.jpg");
	JLabel lblNewLabel_2 = new JLabel(new ImageIcon("C:/Project/IDF1/MiscFiles/Picture4.jpg"));
	lblNewLabel_2.setBounds(0, 0, 411, 374);
	panel.add(lblNewLabel_2);
	
	
	

}
}
